<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>美妍社后台登录</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<!-- load css -->
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/css/login.css" media="all">
</head>
<body>
<div class="layui-canvs"></div>
<div class="layui-layout layui-layout-login">
	<h1>
		 <strong>美yan币管理系统后台</strong>
		 <em>UserLogin</em>
	</h1>
	<form method="post" id="form">
	<div class="layui-user-icon larry-login">
		 <input type="text" placeholder="账号" class="login_txtbx" name="account" id="account"/>
	</div>
	<div class="layui-pwd-icon larry-login">
		 <input type="password" placeholder="密码" class="login_txtbx" name="password" id="password"/>
	</div>
    <div class="layui-val-icon larry-login">
    	<div class="layui-code-box">
    		<input type="text" name="code" id="code" placeholder="验证码" maxlength="4" class="login_txtbx" >
            <img  src="${pageContext.request.contextPath }/verificationCode" class="verifyImg" onclick="ChangeImg()" id="img">
    	</div>
    </div> 
     <div class="layui-val-icon larry-login">
     		<div class="layui-code-box">
     	<input name="remeberMe" id="remeberMe" type="checkbox"/><b class="login_txtbx">记住我</b>
     	</div>
     	</div>
    <div class="layui-submit larry-login">
    	<input type="button" value="立即登陆" class="submit_btn" onclick="SubmitLogin()"/>
    </div>
    </form>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/common/layui/lay/dest/layui.all.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/js/login.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jsplug/jparticle.jquery.js"></script>
<script type="text/javascript">

//登录

 function SubmitLogin(){
	 var remeberMe='';
	if($('#remeberMe').is(":checked")){
		remeberMe=true;
	}else{
		remeberMe=false;
	}
	var code=$("#code").val();
	var account=$("#account").val();
	var password=$("#password").val();
	$.ajax({
		type:"post",
		data:{"code":code,"account":account,"password":password,"remeberMe":remeberMe},
		url:"${pageContext.request.contextPath }/user/userlogin",
		success:function(msg){
			if(msg.length>20){
				location.href='${pageContext.request.contextPath }/user/index';
			}else{
				alert(msg);
			}
			
		}
	});
} 

//改变验证码
function ChangeImg(){
		$("#img").attr("src","${pageContext.request.contextPath }/verificationCode?"+Math.random());
	}
	
$(function(){
	$(".layui-canvs").jParticle({
		background: "#141414",
		color: "#E6E6E6"
	});
});
</script>
</body>
</html>